package com.itheima.service.pmsService.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.itheima.domain.db.pms.PmsProductFullReduction;
import com.itheima.mapper.pmsMapper.ProductFullReductionMapper;
import com.itheima.service.pmsService.PmsProductFullReductionServcie;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService
public class PmsProductFullReductionServiceImpl implements PmsProductFullReductionServcie {

    @Autowired
    ProductFullReductionMapper productFullReductionMapper;

    @Override
    public void add(PmsProductFullReduction relation) {
        productFullReductionMapper.insert(relation);
    }

    @Override
    public List<PmsProductFullReduction> getInfoByBrandId(Long id) {
        LambdaQueryWrapper<PmsProductFullReduction> lqw = new LambdaQueryWrapper<>();
        lqw.eq(PmsProductFullReduction::getProductId,id);
        return productFullReductionMapper.selectList(lqw);
    }

    @Override
    public void update(PmsProductFullReduction relation) {
        productFullReductionMapper.updateById(relation);
    }
}
